package cn.wk.demo;

import java.util.Comparator;

public class comparatorByName implements Comparator {
	@Override
	public int compare(Object o1, Object o2) {
		Person p1 = (Person) o1;
		Person p2 = (Person) o2;
		int temp = p1.name.compareTo(p2.name);
		return temp==0? p1.age-p2.age : temp;
	}
}
